<template>
  <Dialog  v-model="visible" title="请求参数" :width="600">
    <json-viewer :value="jsonData" copyable :boxed="false" :sort="false" ></json-viewer>
  </Dialog>
</template>

<script setup lang="ts">
  import { ref, unref, nextTick, watch, reactive } from 'vue'
  import { ElTree, ElInput, ElButton, ElPopconfirm, ElCascader } from 'element-plus'
  import OperationLogList from './operation-log-list.vue'
  const visible = ref(false)
  const jsonData = ref()

  const openDialog = (requestParams?: any) => {
    if (typeof requestParams == "string") {
      try {
          var obj = JSON.parse(requestParams);
          if (typeof obj == "object" && obj) {
            jsonData.value = obj;
          }
      } catch (e) {
          console.log("error:JSON解析失败:" + requestParams + "!!!" + e);
          jsonData.value = "";
      }
    } else {
      jsonData.value = requestParams;
    }
    visible.value = true
  }

  defineExpose({
    openDialog
  })
</script>

